#pragma once

#include <vector>
#include <memory>
#include "rtda/heap/class_member.h"
#include "classfile/class_file.hpp"

namespace jvm {
namespace heap {

class Method : public ClassMember {
private:
    uint m_maxStack;
    uint m_maxLocals;
    std::vector<uint8_t> m_code;

public:
    Method(std::shared_ptr<Class> pClass, const std::shared_ptr<classfile::MemberInfo> pMemberInfo);
    static std::vector<std::shared_ptr<Method>> newMethods(std::shared_ptr<Class> pClass, const std::vector<std::shared_ptr<classfile::MemberInfo>>& cfMethods);
    
    void copyAttributes(const std::shared_ptr<classfile::MemberInfo> pMemberInfo);
    
    // Access flags
    bool isSynchronized() const;
    bool isBridge() const;
    bool isVarargs() const;
    bool isNative() const;
    bool isAbstract() const;
    bool isStrict() const;
    
    // Getters
    uint getMaxStack() const;
    uint getMaxLocals() const;
    const std::vector<uint8_t>& getCode() const;
};

} // namespace heap
} // namespace jvm
